package com.sale.system.dubbo;

import com.sale.system.api.RemoteSubsidiary;
import com.sale.system.domain.dto.SysTheDropDto;
import com.sale.system.mapper.SysAuxiliaryDataMapper;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * 辅助资料
 */
@RequiredArgsConstructor
@Service
@DubboService
public class RemoteSubsidiaryImpl implements RemoteSubsidiary {

    private final SysAuxiliaryDataMapper sysAuxiliaryDataMapper;

    /**
     * 辅助资料 其他支出类型
     * @param
     * @return Map<String, String>
     */
    @Override
    public Map<String, String> selectDisburseList() {
        List<SysTheDropDto> list = sysAuxiliaryDataMapper.selectDisburseList();
        Map<String, String> map = list.stream().collect(Collectors.toMap(SysTheDropDto::getValue,SysTheDropDto::getLabel));
        return map;
    }

    /**
     * 辅助资料 其他收入类型
     * @param
     * @return Map<String, String>
     */
    @Override
    public Map<String, String> selectIncomeList() {
        List<SysTheDropDto> list = sysAuxiliaryDataMapper.selectIncomeList();
        Map<String, String> map = list.stream().collect(Collectors.toMap(SysTheDropDto::getValue,SysTheDropDto::getLabel));
        return map;
    }
}
